//
//  RLNearyByCell.m
//  RelaxLinkProduct
//
//  Created by relax on 2017/11/29.
//  Copyright © 2017年 relax. All rights reserved.
//

#import "RLNearyByCell.h"

#define nearbyCellMargin 8

@interface RLNearyByCell ()
/**
 头像
 */
@property (nonatomic,weak) UIImageView *headerImageView;
/** 距离 */
@property (nonatomic,weak) UILabel *distanceLabel;

@end

@implementation RLNearyByCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self initUI];
    }
    return self;
}

- (void)initUI {
    // CGFloat imgVW = self.bounds.size.width - (nearbyCellMargin * 2);
    CGFloat imgVH = self.bounds.size.height - 20;
    
    /** 用户头像 */
    UIImageView *headerImageView = [[UIImageView alloc] init];
    headerImageView.image = [UIImage imageNamed:@"hmj.jpg"];
    headerImageView.clipsToBounds = YES;
    headerImageView.contentMode = UIViewContentModeScaleAspectFill;
    
    [self.contentView addSubview:headerImageView];
    
    [headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.offset(0);
        make.width.offset(self.bounds.size.width);
        make.height.offset(imgVH);
    }];
    
    
    /** 用户昵称 */
    UILabel * distanceLabel = [[UILabel alloc] init];
    distanceLabel.text = @"1.4 KM";
    distanceLabel.textAlignment = NSTextAlignmentCenter;
    distanceLabel.font = [UIFont systemFontOfSize:14];
    distanceLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:distanceLabel];
    
    [distanceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headerImageView);
        make.top.equalTo(headerImageView.mas_bottom).offset(8);
        make.width.offset(self.bounds.size.width);
    }];
    
}

@end
